package math;

public class CountOfMatchesInTournament1688 {
    public int numberOfMatches2(int n) {
        return n-1;
    }
        public int numberOfMatches(int n) {
        if(n<=1){
            return 0;
        }
        if(n==2){
            return 1;
        }
        int count = n/2;
        if(n%2==1){
            n = n+1;
        }
        return count + numberOfMatches(n/2) ;
    }
}
